import Vue from "vue";
import App from "./App.vue";
import "bootstrap/dist/css/bootstrap.css";
import "./assets/fonts/iconfont.css";
import axios from "axios";
import MyGoodsList from "./views/MyGoodsList.vue";
import MyGoodsSearch from "./views/MyGoodsSearch.vue";
import MyUserInfo from "./views/MyUserInfo.vue";
// 2导入路由
import VueRouter from "vue-router";
// 3在vue中，使用使用vue的插件，都需要调用Vue.use()
Vue.use(VueRouter);
//4路由规则
const routes = [
  {
    path: "/",
    name: "MyGoodsList",
    redirect: "/mygoodslist", //重定向到MyGoodsList页
  },
  {
    path: "/mygoodslist",
    name: "MyGoodsList",
    component: MyGoodsList,
  },
  {
    path: "/mygoodssearch",
    name: "MyGoodsSearch",
    component: MyGoodsSearch,
  },
  {
    path: "/myuserInfo",
    name: "MyUserInfo",
    component: MyUserInfo,
  },
];
// 5、路由规则放到路由对象中
const router = new VueRouter({
  routes,
});

axios.defaults.baseURL = "https://www.escook.cn";

Vue.prototype.$axios = axios;

Vue.config.productionTip = false;

// 将路由对象注入到实例
new Vue({
  router,
  render: (h) => h(App),
}).$mount("#app");
